<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      body {
        background-color: #efefef;
      }
      .address {
        display: flex;
        flex-direction: column;
      }
      .orderBtn {
        margin-top: 20px;
        border-radius: 5px;
        background-color: white;
        border: 1px solid black;
        box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2),
          0 6px 20px 0 rgba(0, 0, 0, 0.19);
      }
    </style>
  </head>
  <body>
    <div class="address">
      <label for="address">地址</label>
      <textarea
        name="address"
        id="address"
        address
        cols="30"
        rows="10"
      ></textarea>
    </div>
    <button class="orderBtn">下单</button>
    <script>
      const orderBtn = document.querySelector(".orderBtn");
      const address = document.querySelector("#address");
      orderBtn.addEventListener("click", () => {
        const addressValue = address.value;
        if (addressValue) {
          window.location.href = `http://localhost:3000/order?address=${addressValue}`;
        } else {
          alert("请填写地址");
        }
      });
    </script>
  </body>
</html>
